package comxxxx.controller;

import comxxxx.pojo.Order;
import comxxxx.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zzuli_huahua
 * @version 1.0
 * @date 2022/1/14 11:52
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    /**
     * 根据主键 id 查询订单
     * @param id
     * @return
     */
    @GetMapping("/{id}/product/list")
    public Order selectOrderById(@PathVariable("id") Integer id){
        return orderService.selectOrderById(id);
    }

    /**
     * 根据主键查询订单-商品服务 /product/listByIds
     * @param id
     * @return
     */
    @GetMapping("/{id}/product/list")
    public Order queryOrderById(@PathVariable("id") Integer id){
        return orderService.queryOrderById(id);
    }

    @GetMapping("/{id}/product")
    public Order searchOrderById(@PathVariable("id") Integer id){
        return orderService.searchOrderById(id);
    }
}
